﻿using System.Web.Mvc;
using NetSurveillance.WebApp.Models;

namespace NetSurveillance.WebApp.Controllers
{
    public class InteractiveController : BaseController
    {
        [HttpPost]
        public ActionResult InteractiveStatus(string interactiveKey)
        {
            long? interactiveId = ApplicationContainer.Read<long?>(interactiveKey);
            if (interactiveId.HasValue)
            {
                var interactive = DataProvider.InteractiveService.GetModelById(interactiveId.Value);
                if (interactive != null)
                {
                    return CamelCaseJson(new AjaxResult(true) { Expandos = new { interactive.InteractiveStatus } });
                }
            }
            return CamelCaseJson(new AjaxResult(false, string.Format("当前线程中无{0}的值", interactiveKey)));
        }
    }
}
